var status = -1;
var map = 910310000;
var num = 5;
var maxp = 5;

function start() {
    status = -1;
    action(1, 0, 0)
}

function action(e, c, b) {
    if (e == 1) {
        status++
    } else {
        if (status <= 1) {
            cm.dispose();
            return
        }
        status--
    }
    if (status == 0) {
        var d = "Would you like to go into the Training Center?";
        for (var a = 0; a < num; a++) {
            d += "\r\n#b#L" + a + "#Training Center " + a + " (" + cm.getPlayerCount(map + a) + "/" + maxp + ")#l#k"
        }
        cm.askMenu(d)
    } else {
        if (status == 1) {
            if (b < 0 || b >= num) {
                cm.dispose()
            } else {
                if (cm.getPlayerCount(map + b) >= maxp) {
                    cm.sendNext("This training center is full.");
                    status = -1
                } else {
                    cm.warp(map + b, 0);
                    cm.dispose()
                }
            }
        }
    }
};